nodejs22.x/hello-gql/{{cookiecutter.project_name}}/gql/preprocessPostItem.js (12 lines of code) (raw):
import { util } from "@aws-appsync/utils";
export function request(ctx) {
const id = util.autoId();
const { ...values } = ctx.args;
values.ups = 1;
values.downs = 0;
values.version = 1;
return { payload: { key: { id }, values: values } };
}
export function response(ctx) {
return ctx.result;
}